export default {
	namespaced: true,
	state: () => {
		return {
			address: uni.getStorageSync('address') || {},
			token: uni.getStorageSync('token') || '',
			userInfo: uni.getStorageSync('userInfo') || {}
		}
	},
	// 提供一个与之对应的用来修改他的方法
	mutations: {
		setAddress(state, addr) {
			state.address = addr
			uni.setStorageSync('address', state.address)
		},
		setToken(state, token) {
			state.token = token
			uni.setStorageSync('token', token)
		},
		setUserInfo(state, info) {
			state.userInfo = info
			uni.setStorageSync('userInfo', state.userInfo)
		}
	},
	getters: {
		addStr(state) {
			const addr = state.address
			return addr.provinceName + addr.cityName + addr.countyName + addr.detailInfo
		}
	},
}
